#include "CharacterTab.h"
#include "NewCharacterDialog.h"

#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;


namespace lcabinet {

	/// <summary>
	/// Summary for BaseScreen
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class BaseScreen : public System::Windows::Forms::Form
	{
	public:
		BaseScreen(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~BaseScreen()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::MenuStrip^  menuStrip1;
	private: System::Windows::Forms::ToolStripMenuItem^  mnuFile;
	private: System::Windows::Forms::ToolStripMenuItem^  mnuFileNew;
	private: System::Windows::Forms::ToolStripMenuItem^  mnuFileSave;
	private: System::Windows::Forms::ToolStripMenuItem^  mnuFileExit;
	private: System::Windows::Forms::ToolStripMenuItem^  mnuHelp;
	private: System::Windows::Forms::ToolStripMenuItem^  mnuHelpAbout;
	protected: 






	private: System::Windows::Forms::ToolStrip^  toolStrip1;
	private: System::Windows::Forms::ToolStripDropDownButton^  toolStripDropDownButton1;
	private: System::Windows::Forms::ToolStripMenuItem^  tbNewCharacterButton;

	private: System::Windows::Forms::TabControl^  tabCharSelect;
	private: System::Windows::Forms::ToolStripMenuItem^  closeToolStripMenuItem;


	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(BaseScreen::typeid));
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
			this->mnuFile = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->mnuFileNew = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->closeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->mnuFileSave = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->mnuFileExit = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->mnuHelp = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->mnuHelpAbout = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
			this->toolStripDropDownButton1 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
			this->tbNewCharacterButton = (gcnew System::Windows::Forms::ToolStripMenuItem());
			this->tabCharSelect = (gcnew System::Windows::Forms::TabControl());
			this->menuStrip1->SuspendLayout();
			this->toolStrip1->SuspendLayout();
			this->SuspendLayout();
			// 
			// menuStrip1
			// 
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->mnuFile, this->mnuHelp});
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
			this->menuStrip1->Name = L"menuStrip1";
			this->menuStrip1->Size = System::Drawing::Size(722, 24);
			this->menuStrip1->TabIndex = 0;
			this->menuStrip1->Text = L"mnuMainMenu";
			// 
			// mnuFile
			// 
			this->mnuFile->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->mnuFileNew, 
				this->closeToolStripMenuItem, this->mnuFileSave, this->mnuFileExit});
			this->mnuFile->Name = L"mnuFile";
			this->mnuFile->Size = System::Drawing::Size(37, 20);
			this->mnuFile->Text = L"File";
			// 
			// mnuFileNew
			// 
			this->mnuFileNew->Name = L"mnuFileNew";
			this->mnuFileNew->Size = System::Drawing::Size(152, 22);
			this->mnuFileNew->Text = L"New";
			this->mnuFileNew->Click += gcnew System::EventHandler(this, &BaseScreen::newCharacterTab);
			// 
			// closeToolStripMenuItem
			// 
			this->closeToolStripMenuItem->Name = L"closeToolStripMenuItem";
			this->closeToolStripMenuItem->Size = System::Drawing::Size(152, 22);
			this->closeToolStripMenuItem->Text = L"Close";
			this->closeToolStripMenuItem->Click += gcnew System::EventHandler(this, &BaseScreen::closeCharacterTab);
			// 
			// mnuFileSave
			// 
			this->mnuFileSave->Name = L"mnuFileSave";
			this->mnuFileSave->Size = System::Drawing::Size(152, 22);
			this->mnuFileSave->Text = L"Save";
			// 
			// mnuFileExit
			// 
			this->mnuFileExit->Name = L"mnuFileExit";
			this->mnuFileExit->Size = System::Drawing::Size(152, 22);
			this->mnuFileExit->Text = L"Exit";
			// 
			// mnuHelp
			// 
			this->mnuHelp->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->mnuHelpAbout});
			this->mnuHelp->Name = L"mnuHelp";
			this->mnuHelp->Size = System::Drawing::Size(44, 20);
			this->mnuHelp->Text = L"Help";
			// 
			// mnuHelpAbout
			// 
			this->mnuHelpAbout->Name = L"mnuHelpAbout";
			this->mnuHelpAbout->Size = System::Drawing::Size(107, 22);
			this->mnuHelpAbout->Text = L"About";
			// 
			// toolStrip1
			// 
			this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->toolStripDropDownButton1});
			this->toolStrip1->Location = System::Drawing::Point(0, 24);
			this->toolStrip1->Name = L"toolStrip1";
			this->toolStrip1->Size = System::Drawing::Size(722, 25);
			this->toolStrip1->TabIndex = 1;
			this->toolStrip1->Text = L"tbMainToolbar";
			// 
			// toolStripDropDownButton1
			// 
			this->toolStripDropDownButton1->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->toolStripDropDownButton1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->tbNewCharacterButton});
			this->toolStripDropDownButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripDropDownButton1.Image")));
			this->toolStripDropDownButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
			this->toolStripDropDownButton1->Name = L"toolStripDropDownButton1";
			this->toolStripDropDownButton1->Size = System::Drawing::Size(29, 22);
			this->toolStripDropDownButton1->Text = L"New";
			// 
			// tbNewCharacterButton
			// 
			this->tbNewCharacterButton->Name = L"tbNewCharacterButton";
			this->tbNewCharacterButton->Size = System::Drawing::Size(125, 22);
			this->tbNewCharacterButton->Text = L"Character";
			this->tbNewCharacterButton->Click += gcnew System::EventHandler(this, &BaseScreen::newCharacterTab);
			// 
			// tabCharSelect
			// 
			this->tabCharSelect->Alignment = System::Windows::Forms::TabAlignment::Bottom;
			this->tabCharSelect->Dock = System::Windows::Forms::DockStyle::Fill;
			this->tabCharSelect->HotTrack = true;
			this->tabCharSelect->Location = System::Drawing::Point(0, 49);
			this->tabCharSelect->Name = L"tabCharSelect";
			this->tabCharSelect->Padding = System::Drawing::Point(0, 0);
			this->tabCharSelect->SelectedIndex = 0;
			this->tabCharSelect->Size = System::Drawing::Size(722, 552);
			this->tabCharSelect->TabIndex = 2;
			// 
			// BaseScreen
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(722, 601);
			this->Controls->Add(this->tabCharSelect);
			this->Controls->Add(this->toolStrip1);
			this->Controls->Add(this->menuStrip1);
			this->MainMenuStrip = this->menuStrip1;
			this->Name = L"BaseScreen";
			this->Text = L"LCabinet";
			this->menuStrip1->ResumeLayout(false);
			this->menuStrip1->PerformLayout();
			this->toolStrip1->ResumeLayout(false);
			this->toolStrip1->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion

		System::Void newCharacterTab(System::Object^ sender, System::EventArgs^ e)
		{
			NewCharacterDialog^ frmNewCharDlg = gcnew NewCharacterDialog();

			frmNewCharDlg->ShowDialog();
			if (frmNewCharDlg->DialogResult == System::Windows::Forms::DialogResult::OK)
			{
				String^ title = "Unnamed";
				TabPage^ newTabPage = gcnew TabPage(title);
				CharacterTab^ newCharTab = gcnew CharacterTab();

				tabCharSelect->TabPages->Add(newTabPage);
				newCharTab->TopLevel = false;
				newCharTab->Parent = newTabPage;
				newCharTab->Dock = DockStyle::Fill;
				newTabPage->Controls->Add(newCharTab);
				newCharTab->Show();
				newCharTab->SetTypeNode(frmNewCharDlg->GetTypeNode());
				newCharTab->SetTemplateNode(frmNewCharDlg->GetTemplateNode());
				delete frmNewCharDlg;
			}
			else
			{
				delete frmNewCharDlg;
			}
		}

		System::Void closeCharacterTab(System::Object^ sender, System::EventArgs^ e)
		{
			tabCharSelect->TabPages->Remove(tabCharSelect->SelectedTab);
		}
	};
}
